<template>
  <MainLayout title="页面标题">
    <view class="p-12">
      <view class="title">我的记录</view>

      <view v-if="!list.length" class="empty">暂无记录</view>

      <view v-for="(it, i) in list" :key="i" class="item">
        <view class="row">
          <text class="name">{{ it.name }}</text>
          <text class="time">{{ it.time }}</text>
        </view>
        <view class="meta">项目：{{ it.project || '-' }}</view>
        <view class="meta">结果：{{ it.result || '-' }}</view>
      </view>
    </view>
  </MainLayout>


</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import MainLayout from '@/layouts/MainLayout.vue'
// 先用占位数据；后续你把这里替换为实际接口调用即可：
const list = ref<{name:string; time:string; project:string; result:string}[]>([])

onMounted(async () => {
  // 如果你已经实现了 api.fetchMyRecords，可这样调用：
  // const data = await (api as any).fetchMyRecords().catch(()=>[])
  // list.value = data

  // 先给两条假数据，确保页面可用
  list.value = [
    { name: '钢筋接头抽检', time: '2025-08-15 09:30', project: '一标段主楼', result: '合格' },
    { name: '混凝土坍落度',  time: '2025-08-15 14:20', project: '二标段地下室', result: '合格' }
  ]
})
</script>

<style scoped>
.p-12{ padding:12px;}
.title{ font-size:18px; font-weight:700; margin-bottom:10px;}
.item{ background:#fff; border-radius:8px; padding:12px; margin-bottom:10px; }
.row{ display:flex; justify-content:space-between; align-items:center; }
.name{ font-weight:600; }
.time{ color:#999; font-size:12px; }
.meta{ color:#666; margin-top:6px; font-size:13px; }
.empty{ color:#999; text-align:center; margin-top:40px; }
</style>
